﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace frmPrincipal
{
    public partial class frmConCompras : Form
    {
        private int callWidth;
        private int callHeight;

        public frmConCompras()
        {
            this.callWidth = 700;
            this.callHeight = 300;

            InitializeComponent();
        }

        //Chama os Respectivos Formulários
        private void btnSearchAll_Click(object sender, EventArgs e)
        {
            frmConsultaBasica queryAll;
            string title = "Consulta de Todas as Compras de Fornecedores";
            string sqlCommandText;

            sqlCommandText = "SELECT data, quantidade, cnpj_forn, cod_produto, nome_prod, preco_custo "+
                    "FROM fornece INNER JOIN produto ON(cod_produto = cod_prod) "+
                    "ORDER BY data DESC";

            queryAll = new frmConsultaBasica(title, sqlCommandText, callWidth, callHeight);
            queryAll.Show();
        }
        private void btnSearchByDate_Click(object sender, EventArgs e)
        {
            frmConPorData queryByDate;

            queryByDate = new frmConPorData("Consulta de Compras por Data", "fornece", callWidth, callHeight);
            queryByDate.Show();
        }

        //Volta no frmConsultaPrincipal
        private void btnReturn_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
